#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll n, l, r, m, last;

int main(){
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin >> n >> l >> r;
	last = (l / n) * n;
	if(last + n - 1 < r)	cout << n - 1 << endl;
	else	cout << r % n << endl;
	return 0;
	
}
